import Vue from 'vue'
import Router from 'vue-router'
import LoginIn from '../views/LoginIn.vue'
import SignUp from '../views/SignUp.vue'
import MainTable from '../views/MainTable.vue'
import Home from '../views/Home.vue'
import OneSinger from '../views/OneSinger.vue'
import OneSongList from '../views/OneSongList.vue'
import Lyric from '../views/Lyric.vue'
import SearchSongs from '../components/search/SearchSongs.vue'
import SongList from '../views/SongList.vue'
import Singer from '../views/Singer.vue'


// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(Router)

export default new Router({
  routes: [{
      path: '/login-in',
      name: 'login-in',
      component: LoginIn
    },
    {
      path: '/sign-up',
      name: 'sign-up',
      component: SignUp
    },
    {
      path: '/',
      name: 'MainTable',
      component: MainTable,
      children: [{
          path: '/home',
          name: 'Home',
          component: Home
        },

      ]
    },
    {
      path: '/oneSinger',
      name: 'oneSinger',
      component: OneSinger
    },
    {
      path: '/song-list',
      name: 'song-list',
      component: SongList
    },
    {
      path: '/singer',
      name: 'singer-list',
      component: Singer
    },
    {
      path: '/oneSongList',
      name: 'oneSongList',
      component: OneSongList
    },
    {
      path: '/lyric',
      name: 'Lyric',
      component: Lyric
    },
    {
      path: '/searchSongs',
      name: 'SearchSongs',
      component: SearchSongs
    },
  ]
})
